//*****************************************************************************
// file        : a2b.h
// a2b related configuration header
// Copyright (c) 2023-2024 dynaudio co. Ltd. All rights reserved
//
// Change Logs:
// Date                 Author      Note
// 2024/04/25           Cheney      First draft version
//
//*****************************************************************************
#ifndef __A2B_H__
#define __A2B_H__

//*****************************************************************************
//
//! \addtogroup a2b
//! @{
//
//*****************************************************************************
#include "stdint.h"

//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif

typedef struct
{
    /*! Device address */
    unsigned char nDeviceAddr;

    /*! Operation code */
    unsigned char eOpCode;

    /*! Reg Sub address width (in bytes) */
    unsigned char nAddrWidth;

    /*! Reg Sub address */
    unsigned int nAddr;

    /*! Reg data width (in bytes) */
    unsigned char nDataWidth;

    /*! Reg data count (in bytes) */
    unsigned short nDataCount;

    /*! Config Data */
    unsigned char *paConfigData;

} Ad2428ConfigList_t;

typedef enum
{
    A2B_NETWORK_ID_0,
    A2B_NETWORK_ID_MAX
} A2bNetworkId_t;

typedef struct
{
    uint16_t DeviceAddr;
    int (*I2cWritePtr)(uint16_t address, uint16_t nWrite, uint8_t *wbuf);
    int (*I2cWriteReadPtr)(uint16_t address, uint16_t nWrite, uint8_t *wbuf, uint16_t nRead, uint8_t *rbuf);
    Ad2428ConfigList_t *ConfigList;
    uint32_t ListSize;
} A2bNetworkInfo_t;

extern const A2bNetworkInfo_t A2bNetworkInfo[];

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************

#ifdef __cplusplus
}
#endif

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
#endif //  __A2B_H__